package com.landscope.issue.controller.api;

import com.landscope.issue.controller.api.dto.*;
import com.landscope.issue.controller.api.param.*;
import com.landscope.issue.controller.base.BaseController;
import com.landscope.issue.controller.base.ResponseResult;
import com.landscope.issue.service.ApiStaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author qzp
 * @version v1.0
 * @date 2021/8/5 22:07
 **/
@RequestMapping("api/m/sta")
@RestController
@Api(tags = "3.首页单项数据")
@CrossOrigin
public class ApiStaController extends BaseController {

    @Resource
    private ApiStaService apiStaService;

    @PostMapping("/info")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "3.1 单独获取实时台站信息", notes = "单独获取实时台站信息")
    public ResponseResult<List<StaListDataDto>> info(@RequestBody StaInfoParam param) {
        return apiStaService.info(param);
    }

    @PostMapping("/changeData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "3.2 根据时间获取检测变化数据", notes = "根据时间获取检测变化数据")
    public ResponseResult<MonitorDataDto> changeData(@RequestBody ChangeDataParam param) {
        return apiStaService.changeData(param);
    }

    @PostMapping("/coreData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "3.3 根据时间获取核心监测数据", notes = "根据时间获取核心监测数据")
    public ResponseResult<CoreDataDto> coreData(@RequestBody CoreDataParam param) {
        return apiStaService.coreData(param);
    }

    @PostMapping("/downloadReport")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "3.4 检测报告列表", notes = "检测报告列表")
    public ResponseResult<DownLoadReportDto> downloadReport(@RequestBody DownloadReportParam param) {
        return apiStaService.downloadReport(param);
    }

    @PostMapping(value = "/getWarningList",consumes = {MediaType.APPLICATION_JSON_VALUE})
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "3.5 获取最新报警信息", notes = "获取最新报警信息")
    public ResponseResult<List<WarningDto>> getWarningList(@RequestBody GetWarningListParam param) {
        return apiStaService.getWarningList(param);
    }
}
